/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package main;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author dalexandre
 */
public class Centroid {

    private int id;
    private List<DataVector> assignedDataVectors;
    private double [] position;

    public Centroid(int id, int dimension) {
        this.id = id;
        this.position = new double[dimension];
        this.assignedDataVectors = new ArrayList<DataVector>();
    }

    public List<DataVector> getAssignedDataVectors() {
        return assignedDataVectors;
    }

    public void setAssignedDataVectors(List<DataVector> assignedDataVectors) {
        this.assignedDataVectors = assignedDataVectors;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double[] getPosition() {
        return position;
    }

    public void setPosition(double[] position) {
        this.position = position;
    }

    @Override
    public Centroid clone() {

        Centroid clone = new Centroid(this.id, this.position.length);

        for (int i = 0; i < this.position.length; i++) {
            clone.getPosition()[i] = this.position[i];
        }

        for (DataVector dataVector : assignedDataVectors) {
            clone.getAssignedDataVectors().add(dataVector);
        }
        
        return clone;
        
    }


}
